﻿@model IEnumerable<FPP.Models.News>
@{
    ViewBag.Title = "Famous People Pool - Home";
}
<script type="text/javascript">
    $(document).ready(function () {
        $.ajax({
            type: "POST",
            url: "/Games/TenGames",
            data: {},
            dataType: "json",
            success: function (data) {
                $('#OpenGames').replaceWith(ProcessOpenGames(data));
            }
        });
    });
</script>
<script type="text/javascript">
    function ProcessOpenGames(data) {
        var rtn = "";

        $.each(data, function (index) {
            // do stuff
            rtn = rtn + "<tr><td><a href=\"" + data[index].DetailsURL + "\">" + data[index].Name + "</a></td><td>" + data[index].StartDate + "</td><td>" + data[index].EndDate + "</td><td>&nbsp;</td></tr>";

        });

        return rtn;
    }
</script>
<fieldset class="fieldsetNoBorder">
    <legend>Games Listing</legend>
    <table>
        <tr>
            <th>
                Name
            </th>
            <th>
                Date Start
            </th>
            <th>
                Date End
            </th>
        </tr>
        <tr id="OpenGames">
        </tr>
    </table>
</fieldset>
<fieldset class="fieldsetNoBorder">
    <legend>Current Activity</legend>
    @foreach (var item in Model)
    {
        <h1 class="clear">
            <a href="@item.SourceUrl" target="_blank" >@item.Title</a>
        </h1>
        if (!string.IsNullOrEmpty(item.Image))
        { 
            <img class="column prepend-1" style="max-height: 75px; max-width: 75px;" src=@item.Image />
            @:<p class="column">
        }
        else
        { 
            @:<p class="column prepend-1">
        }
            @Html.EncodedMultiLineText(item.Body)
            @:</p>
   }
</fieldset>
